<extend name="Public/base" />

<block name="body">
    <form method="POST" id="orderlist" action="">
        <!-- 标题栏 -->
        <div class="main-title">
            <h2>用户管理</h2>
        </div>
        <div class="cf">
            <!-- 高级搜索 -->
            <div class="search-form fr cf">
                <div class="sleft" style="margin-right: 2px;">
                    <select name="status"  style="height: 30px;width:120px">
                        <option value="999" {$status =="999"?'selected':''}>全部</option>
                        <option value="0" {$status =="0"?'selected':''}>未受理</option>
                        <option value="1" {$status =="1"?'selected':''}>未审核</option>
                        <option value="2" {$status =="2"?'selected':''}>已通过</option>
                        <option value="-1" {$status =="-1"?'selected':''}>未通过</option>
                    </select>
                </div>
                <div class="sleft" style="margin-right: 2px;">
                    <input type="text" name="realName" class="search-input" value="{:I('realName')}"  placeholder="用户姓名" style="height: 30px;width:80px">
                </div>
                <div class="sleft" style="margin-right: 2px;">
                    <input type="text" name="phone" class="search-input" value="{:I('phone')}"  placeholder="手机号" style="height: 30px;width:100px">
                </div>
                <div class="sleft" style="margin-right: 2px;">
                    <input type="text" name="city" class="search-input" value="{:I('city')}"  placeholder="地区" style="height: 30px;width:100px">
                </div>
                <div class="sleft">
                    <input type="text" name="sname" class="search-input" value="{:I('sname')}" placeholder="业务员">
                    <a class="sch-btn" href="javascript:;" id="search" url="{:U('contractapplyindex')}"><i class="btn-search"></i></a>
                </div>
            </div>
        </div>


        <!-- 数据列表 -->
        <div class="data-table table-striped">
            <table class="">
                <thead>
                <tr>
                    <th class="">ID</th>
                    <th class="">地区</th>
                    <th>姓名</th>
                    <th>手机</th>
                    <th>店铺名</th>
                    <th>详细地址</th>
                    <th>业务员</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr>
                            <td>{$vo.id} </td>
                            <td>{$vo.city}</td>
                            <td>{$vo.realName}</td>
                            <td>{$vo.phone}</td>
                            <td>{$vo.shopName}</td>
                            <td>{$vo.street}</td>
                            <td>{$vo.sname}</td>
                            <td><if condition="$vo.status eq 0">未受理
                                    <elseif condition="$vo.status eq 1"/>未审核
                                    <elseif condition="$vo.status eq 2"/>已通过
                                    <elseif condition="$vo.status eq -1"/>不通过
                                </if>
                            </td>
                            <td>{$vo.createAt|time_format}</td>
                            <td>
                                <if condition="$vo.status eq 0">
                                    <a href="{:U('relation/acceptdetail?uid='.$vo['uid'])}" class="btn btn-danger">受理</a>
                                    <elseif condition="$vo.status eq 1"/>
                                    <a href="{:U('relation/reviewdetail?uid='.$vo['uid'])}" class="btn btn-warning">审核</a>
                                    <elseif condition="$vo.status eq 2"/>
                                    <a href="{:U('relation/completedetail?uid='.$vo['uid'])}" class="btn btn-success">明细</a>
                                    <elseif condition="$vo.status eq -1"/>
                                    <a href="{:U('relation/completedetail?uid='.$vo['uid'])}" class="btn btn-success">明细</a>
                                </if>
                            </td>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
                </tbody>
            </table>
        </div>
        <div class="page">
            {$_page}
        </div>
    </form>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        $("#search").click(function () {
            var url = $(this).attr('url');

            var query = $('.search-form').find('input').serialize();
            var queryselect = $('.search-form').find('select').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            queryselect = queryselect.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {
                url += '&' + query;
                url += '&' + queryselect;
            } else {
                url += '?' + query;
                url += '?' + queryselect;
            }

            window.location.href = url+='&first=1';
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });

        //导航高亮
        highlight_subnav('{:U('relation/contractapplyindex')}');
    </script>
</block>
